package com.yunhe.marketing.controller;

import com.yunhe.common.model.ResultObject;
import com.yunhe.common.model.mybatis.PageResult;
import com.yunhe.marketing.domain.CompanyHeat;
import com.yunhe.marketing.service.ICompanyHeatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: CompanyHeatController
 * @Description:
 * @author: GongDaCheng
 * @Date: 14:21 2021/3/15
 */
@Api(value = "companyHeat", description = "热度值查询")
@RestController
@RequestMapping("/exposure")
public class CompanyHeatController {
    @Autowired
    ICompanyHeatService iCompanyHeatService;

    @ApiOperation("根据企业id查询单个企业的热度值")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "itemId", value = "对象id", dataType = "long", paramType = "query"),
    })
    @GetMapping(value = "/getHeatCompany")
    public ResponseEntity<ResultObject> selectHeatCompany(@RequestParam("itemId") Long itemId){
        CompanyHeat result = iCompanyHeatService.selectHeatCompany(itemId);
        return new ResponseEntity<>(new ResultObject<>(result), HttpStatus.OK);
    }

    @ApiOperation("查询企业热度列表")
    @GetMapping(value = "/getHeatCompanyList")
    public ResponseEntity<ResultObject> selectHeatCompanyList(@RequestParam("page") int page,
                                                              @RequestParam("size") int size){
        PageResult result = iCompanyHeatService.selectHeatCompanyList(page, size);
        return new ResponseEntity<>(new ResultObject<>(result), HttpStatus.OK);
    }
}
